<%@page import="Model.*" %>
<%@page import="Controller.*" %>
<%@page import="java.util.*" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%
    String machuyen = request.getParameter("MACHUYEN");
    controller_ChuyenTau chuyenTau = new controller_ChuyenTau();
    model_ChuyenTau ct = chuyenTau.Load_CapNhat_ChuyenTau(machuyen);
    
    request.setAttribute("MChuyen", ct.getMACHUYEN());
    request.setAttribute("MTuyen", ct.getMATUYEN());
    request.setAttribute("MDT", ct.getMADT());
    request.setAttribute("TGXP", ct.getTHOIGIANXP());
%>


<fieldset style="margin-top: 20px; margin-bottom: 10px; margin-right: 50px; margin-left: 50px; background-color: #FFFFCC; color: #FF0000">
    <legend>
        <h2>Cập Nhật Chuyến Tàu</h2>
    </legend>
    
    <form action="QL_ChuyenTau/CapNhat.jsp" method="POST" style="margin-top: 20px; padding-left: 20px ">
        Mã Chuyến:
        <input type="text" name="txtMACHUYEN" value="${MChuyen}" size="19" style="margin-left: 13px"/> (*)<br/>
        Mã Tuyến:
        <select name="cmbMATUYEN" style="width: 150px; margin-left: 21px; margin-top: 10px">
            <%
                controller_TuyenTau TTau = new controller_TuyenTau();
                List<model_TuyenTau> tuyenTaus = TTau.LoadList();
                for (model_TuyenTau tt : tuyenTaus) {
            %>    
            
            <option value="<%= tt.getMATUYEN()%>">
                <%= tt.getMATUYEN()%>
            </option>
            <%}%> 
        </select> (*)<br/>
        Mã Đ.Tàu:
        <select name="cmbMADT" style="width: 150px; margin-left: 20px; margin-top: 10px" >
            <%
                controller_DoanTau DTau= new controller_DoanTau();
                List<model_DoanTau> doanTaus = DTau.LoadList();
                for (model_DoanTau dt : doanTaus) {
            %>    
            
            <option value="<%= dt.getMADT()%>">
                <%= dt.getMADT()%>
            </option>
            <%}%> 
        </select> (*)<br/>
        T.Gian XP:
        <input type="text" name="txtTHOIGIANXP" size="50" value="${TGXP}" style="margin-left: 18px; margin-top: 10px"/> (yyyy/MM/dd)<br/>
        
        <input type="submit" value="Cập nhật Chuyến Tàu" style="margin-top: 20px; margin-left: 90px"/>
        <input type="reset" value="Reset" />
    </form>
</fieldset>